Cache Anthropic capabilities and defer compaction lookup - #184
Conversation
|
Integration review against the performance main and PRs #180/#181/#183/#185: the existing combined suite passed 148 tests, but a new focused case exposes an interaction with #181. When the primary generation returns Hold this PR until deferred metadata lookup retains its intended transport retry budget without reintroducing nested retries on streamed generations. Quick regression: use a distinct compaction model, force a |
# Conflicts: # src/Mod/VibeCAD/vibecad_tests/test_provider_subprocess.py
|
Resolved the #181 integration regression in 080c99d and merged current main into this branch without dropping either PR's tests. Deferred metadata temporarily restores the child-owned client's SDK retry allowance and restores the stream setting in a finally block. Red: Green: Auto-merge enabled subject to required checks. |
Reuse Anthropic model output capabilities across user turns through a parent-process cache (64 entries, five-minute TTL), scoped to model, endpoint and authentication identity. Child processes receive validated cached values and report successful lookups back to the parent. Credentials are hashed in cache identity and excluded from capability events.
A distinct compaction model is now resolved only when compaction is needed. Short successful turns avoid that lookup entirely; warm turns also avoid the primary lookup. Model-reported maximum output and older-SDK fallback behavior remain intact. Failed lookups and older-SDK fallback values are not cached.
Verification
With local test dependencies on PYTHONPATH, $python denotes the bundled Python executable:
Tests exercise new provider instances, endpoint/model/auth changes, TTL expiry without sliding refresh, bounded size, failed/invalid metadata, lazy compaction and existing maximum-output/older-SDK behavior. Provider and CAD boundaries are mocked; no paid API calls or full FreeCAD GUI/C++ build were run.
Capabilities may remain stale for up to five minutes. Concurrent cold turns may each retrieve metadata; no cross-process shared disk cache or request coalescing is introduced.
Compatibility
Issues
Closes #178.
Before and After Images
Not applicable; no GUI changes.